package com.maxatime.service.impl;

import com.maxatime.dao.ExamStorageMapper;
import com.maxatime.exception.PhoenixException;
import com.maxatime.pojo.Classroom;
import com.maxatime.pojo.ExamStorage;
import com.maxatime.service.ExamStorageService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Mr.Zhao
 * @title: ExamStorageServiceImpl
 * @projectName phoenix
 * @description: TODO
 * @date 2021/8/4 8:36
 */
@Service
public class ExamStorageServiceImpl implements ExamStorageService {
    Logger log= LogManager.getLogger();

    @Autowired
    private ExamStorageMapper examStorageMapper;

    @Override
    public List<Classroom> storageFind() {
        return examStorageMapper.storageFind();
    }

    @Override
    public Integer insertOrg(ExamStorage clas)throws PhoenixException {
        try {
            return examStorageMapper.insertSelective(clas);
        }catch (Exception e){
            log.error("classroomMapper.insertSelective:::"+clas);
            log.error("classroomMapper.insertSelective:::"+e.getMessage());
            throw new PhoenixException("9999","添加失败");

        }
    }

    @Override
    public Integer orgsdelete(int pkId) {
        return examStorageMapper.deleteByPrimaryKey(pkId);
    }
}
